from glowdrop.message.models import Message

def gen_message(content, src, dest):
    """ generate a message, and return the generated message itself
    @type content: StringType
    @param content: the message's content
    
    @type src: User
    @param src: the one who send the message
    
    @type dest: User
    @param dest: the one who receive the message

    @rtype Message
    @return the generated message
    """
    msg = Message()
    msg.content = content
    msg.src = src
    msg.dest = dest
    msg.save()

    return msg
    #return {'content': msg.content, 'src': src.username, 'dest': dest.username,
            #'pub_date': str(msg.pub_date), 'status': msg.status}

